package model;

import java.awt.geom.Point2D;

/**
 * A package to extract and interact with all placeable game objects.
 * @author N. Bhatia, A. Butt, N. Evans, C. Levesque, P. OKeefe
 *
 */
public class EntityState {

	double orientation;
	Point2D position;
	double speed;

	/**
	 * The state of an entity.  Includes information on position, orientation and etc.
	 */
	public EntityState() {
		this.orientation = 0;
		this.position = new Point2D.Double();
		this.speed = 0;
	}

	/**
	 * Returns the orientation of an entity.
	 * @return the entities orientation.
	 */
	public double getOrientation() {
		return this.orientation;
	}
	/**
	 * Returns the position of an entity.
	 * @return the position of an entity.
	 */
	public Point2D getPosition() {
		return this.position;
	}

	/**
	 * Sets the position of the entity.
	 * @param position The Point2D position to set.
	 */
	public void setPosition(Point2D position) {
		this.position = position;
	}
	/**
	 * Sets the orientation of the entity.
	 * @param orientation The orientation of the name.
	 */
	public void setOrientation(double orientation) {
		this.orientation = orientation;
	}

	/**
	 * Returns the current speed of the GameEntity.
	 * @return The current speed.
	 */
	public double getSpeed() {
		return speed;
	}

	/**
	 * Sets the current speed of the GameEntity.
	 * @param speed The new speed to set.
	 */
	public void setSpeed(double speed) {
		this.speed = speed;
	}

	@Override
	public EntityState clone() {
		EntityState newState = new EntityState();
		newState.setPosition(new Point2D.Double(this.getPosition().getX(), this.position.getY()));
		newState.setOrientation(this.getOrientation());
		newState.setSpeed(this.getSpeed());
		return newState;
	}
}
